import pytest

from Auto.day02.finance.Finance_Data import FinanceData
from Auto.day02.finance.Finance_Operation import Finance_Operation
from utils.ReadYaml import ReadYaml
from utils.XLUtils import XLUtils


class Test_Operation(Finance_Operation):

    @pytest.mark.parametrize("username,password,kind_name,pay_password,expect",FinanceData.Term_Finance_Data)
    def test_qixian_buy(self,username,password,kind_name,pay_password,expect,login_driver,qixian_buy):
        result = self.getResultMsg(login_driver)
        self.assserttitle(login_driver,result,expect)

    @pytest.mark.parametrize("username,password,kind_name,pay_password,expect", FinanceData.jijin_Finance_Data)
    def test_jijin_buy(self, username, password, kind_name, pay_password, expect, login_driver, jijin_buy):
        result = self.getResultMsg(login_driver)
        self.assserttitle(login_driver, result, expect)
#yaml
    @pytest.mark.parametrize("username,password,kind_name,pay_password,expect",
                             ReadYaml.read_yaml("D:\Python\Project\project01\Auto\day02\data.yaml")["Term_Finance_Data"])
    def test_qixian_buy1(self, username, password, kind_name, pay_password, expect, login_driver, qixian_buy):
        result = self.getResultMsg(login_driver)
        self.assserttitle(login_driver, result, expect)

    @pytest.mark.parametrize("username,password,kind_name,pay_password,expect",
                             ReadYaml.read_yaml("D:\Python\Project\project01\Auto\day02\data.yaml")["jijin_Finance_Data"])
    def test_jijin_buy1(self, username, password, kind_name, pay_password, expect, login_driver, jijin_buy):
        result = self.getResultMsg(login_driver)
        self.assserttitle(login_driver, result, expect)
#excel
    @pytest.mark.parametrize("username,password,kind_name,pay_password,expect",
                             XLUtils.read_excel("D:\Python\Project\project01\Auto\day02\data.xlsx","qixian"))
    def test_qixian_buy2(self, username, password, kind_name, pay_password, expect, login_driver, qixian_buy):
        result = self.getResultMsg(login_driver)
        self.assserttitle(login_driver, result, expect)

    @pytest.mark.parametrize("username,password,kind_name,pay_password,expect",
                             XLUtils.read_excel("D:\Python\Project\project01\Auto\day02\data.xlsx","jijin"))
    def test_jijin_buy2(self, username, password, kind_name, pay_password, expect, login_driver, jijin_buy):
        result = self.getResultMsg(login_driver)
        self.assserttitle(login_driver, result, expect)

